﻿using UnityEngine;

namespace Yoozoo.Modules.InnerCity
{
    public class CelebrateAction : ActionBase
    {
        private float totalTime;
        private float curTime;
        
        protected override StateAction state
        {
            get => StateAction.Celebrate;
        }

        public override void Init(CityUnit owner)
        {
            base.Init(owner);
        }

        public override void Enter(object args = null)
        {
            Debug.Log("进入了庆祝状态");
            this.totalTime = (float) args;
            this.curTime = 0;
            this.owner.PlayCelebrateAni();
        }

        public override void Play()
        {
            this.curTime += Time.deltaTime;
            if (this.curTime >= this.totalTime)
                this.owner.CallNewRandomWalk();
        }

        public override void Exit()
        {
            Debug.Log("退出了庆祝状态");
            base.Exit();
        }
    }
}